package ruc.grs.ypytd.web.action;

import ruc.grs.ypytd.entity.Student;
import ruc.grs.ypytd.neoutil.CommonAction;
import ruc.grs.ypytd.service.StudentService;

public class UserAction extends CommonAction {
	private Student student;

	public String login() {
		StudentService studentService = new StudentService();
		Student loginUser = studentService.login(student.getUserName(), student
				.getPassword());
		if (loginUser == null) {
			return INPUT;
		} else {
			student = loginUser;
			setSessionObject("user", loginUser);
			return SUCCESS;
		}
	}

	public Student getStudent() {
		return student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}

}
